package com.jing.product.controller;

import com.jing.product.domain.PmsProduct;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;

@Validated
@RestController
public class TestController {
    @GetMapping("/get")
    String get(@NotBlank(message = "不能为空")String name){
        return name;
    }

    @PostMapping("/save")
    PmsProduct save(@Valid @RequestBody PmsProduct pmsProduct){
        return pmsProduct;
    }

}
